package cn.edu.scau.cmi.lijinzhao.chapter10;

import java.io.*;
import java.util.*;
public class AnalysisResult {
	public static void main(String args[]) {
		File fRead =new File("score.txt");
		File fWrite=new File("scoreAnalysis.txt");
		try {   Writer out=null; // 准备好一个输入的对象
		        out=new FileWriter(fWrite);// 通过对象多态性，进行实例化
				BufferedWriter bufferWrite= new BufferedWriter(out);
				Reader in=null;
				in=new FileReader(fRead);
				BufferedReader bufferRead= new BufferedReader(in);
				String str=null;
				while((str=bufferRead.readLine())!=null) {
					double totalScore=Fenxi.getTotalScore(str);
					str=str+"总分："+totalScore;
					System.out.println(str);
					bufferWrite.write(str);
					bufferWrite.newLine();
				}
			bufferRead.close();
			bufferWrite.close();
		}
		catch(IOException e) {
			System.out.println(e.toString());
		}
	}

}


